package ranab.unit;

/**
 * Force unit converter class.
 *
 * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
 */
public 
class ForceUnit extends BaseUnit {
    
    private final static String[] UNITS = {
        "dynes", 
        "joules/cm",
        "newton",
        "ounce force (ozf)",
        "poundals",
        "pounds (lbf)"    
    }; 
    
    // base weight unit is Newton
    private final static double[] N_TABLE = {
        100000,
        0.01,
        1,
        3.596942,
        7.230658,
        0.224820     
    };
    
    /**
     * Get all the possible units.
     */
    public String[] getAllUnits() {
        return UNITS;
    }
    
    /**
     * Convert one unit from another
     */
    public String convertUnit(String value, int from, int to) throws UnitException {
        double inVal = getDoubleValue(value);
        double outVal = inVal*N_TABLE[to]/N_TABLE[from];
        return String.valueOf(outVal);
    }
    
    /**
     * Return unit type.
     */
    public String toString() {
        return "Force";
    }
    
}